<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="./css/iconfont.css">
    <link rel="stylesheet" href="./css/base.css">
    <link rel="stylesheet" href="./css/coupon.css">
</head>

<body>
    <!-- 头部部分 -->
    <header>
        <div class="coupon">
            <a href="index.html" class="iconfont icon-fanhui"></a>
            优惠券
            <div class="imgs">
                <a href="javascript:;">
                    <img src="./images/header_app.png" alt="">
                </a>
            </div>
        </div>
    </header>

    <!-- 导航显示条 -->
    <nav>
        <a href="index.html">首页&gt;</a>
        <a href="javascript:;">优惠券</a>
    </nav>

    <!-- 商家列表 -->
    <div class="merchant">
        <ul class="clear">
            <li>
                <a href="javascript:;">
                    <img src="" alt="">
                    <span></span>
                </a>
            </li>
        </ul>
    </div>

    <!-- 底部部分 -->
    <footer>
        <div class="direct">
            <a href="javascript:;" class="search">登录</a>
            <a href="javascript:;" class="search">注册</a>
            <a href="#" class="backTop">
                <span></span>返回顶部</a>
        </div>
        <div class="copyright">
            <p>
                <a href="javascript:;">手机APP下载</a> 慢慢买手机版 --
                <span>掌上比价平台</span>
            </p>
            <a href="javascript:;">m.manmanbuy.com</a>
        </div>
    </footer>
</body>

</html>
<script src="./assets/art-template/template-web.js"></script>
<script src="./js/jquery.js"></script>
<script type="text/latetemp" id="temp">
    {{each data value index}}
    <li>
        <a href="couponproduct.html?id={{value.couponId}}&couponTitle={{value.couponTitle}}">
            <img src="{{value.couponImg}}" alt="">
            <span>{{value.couponTitle}}</span>
        </a>
    </li>
    {{/each}}
</script>
<script>
    $.ajax({
        type: 'get',
        url: 'http://193.112.55.79:9090/api/getcoupon',
        dataType: 'json',
        success: function (res) {
            console.log(res);
            var htmlRes = template('temp', {
                data: res.result
            });
            // console.log(htmlRes);
            $('.merchant ul').html(htmlRes);
        }
    })
</script>